package shixhun;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MAp {
    public static void main(String[] args) {
        Map map =new HashMap();
        map.put("linjun","666");
        map.put("yuhao","shenxu");
        map.put("renshengr","shenx");
        //获取元素，根据key的至开获取value
        String str = (String) map.get("linjun");
        System.out.println(str);
        //迭代map元素
        //获取所以key值
        Set set =map.keySet();
        Iterator it=set.iterator();
        while (it.hasNext()){
            String key = (String) it.next();
            String name = (String) map.get(key);
            System.out.println(key+"  "+name);
        }
    }
}
